//
//  CommunitySupermarketMainViewController.m
//  CommunitySupermarketProiect
//
//  Created by 吕惠卿 on 2017/10/13.
//  Copyright © 2017年 吕惠卿. All rights reserved.
//

#import "CommunitySupermarketMainViewController.h"


@interface CommunitySupermarketMainViewController ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic, strong)UITableView *tableView;

@end

@implementation CommunitySupermarketMainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    WhiteColor;
//    NAVIGATIONTITLE(@"社区超市");
    [self creatNavigationItem];
    [self creatUI];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 4;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellID = @"cellID";
    CommunitySupermarketTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (!cell) {
        cell = [[CommunitySupermarketTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.iconImg.image = [UIImage imageNamed:@"社区超市图"];
    cell.metterLab.text = @"<100m";
    cell.nameLab.text = @"77天全天在线超市";
    cell.contLab.text = @"社区:东方家园社区\n地址:重庆九龙坡滨路2号";
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    GengSuperMarketViewController *superVc = [[GengSuperMarketViewController alloc]init];
    [self.navigationController pushViewController:superVc animated:YES];
}
-(void)creatUI{
    RecruitmentView *recView = [[RecruitmentView alloc]initWithFrame:CGRectMake(0, 64, WIDTH, 100)];
    recView.rightImg.image = [UIImage imageNamed:@"免费-入驻"];
    [self.view addSubview:recView];
    
//    NavComView
    
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 164, WIDTH,HEIGHT-164) style:UITableViewStylePlain];
    self.tableView.delegate=self;
    self.tableView.dataSource=self;
    self.tableView.rowHeight = 110;
    self.tableView.tableFooterView = [[UIView alloc] init];
    [self.view addSubview:self.tableView];
}
-(void)creatNavigationItem{
    UIButton *btn = [UIButton new];
    [btn setImage:[UIImage imageNamed:@"返回"] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
    [btn sizeToFit];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
}


- (void)btnClick:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
